public class insort {


    public static void insersort(int[] elem) {
        for (int i = 1; i < elem.length; i++) {
            int tem = elem[i];
            int j = i-1;
            for (; j >=0; j--) {
                if (elem[j] > tem){
                    elem[j+1] = elem[j];
                }else {
                    break;
                }

            }
            elem[j+1] = tem;
        }
    }

}
